
# 九九乘法表for_in 图形一
for col in range(1,10):
    for row in range(1,col+1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print('')
print('='*80)
print('')


# 九九乘法表for_in 图形二
for col in range(9,0,-1):
    for row in range(1,col+1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print('')
print('='*80)
print('')


# 九九乘法表for_in 图形三
for i,col in enumerate(range(1,10)):
    for v,row in enumerate(range(9,0,-1)):
        if 9-v > i+1:
            print('{:<1}{:1}{:<1}{:1}{:<4}'.format(' ',' ',' ',' ',' '),end=' ')
        else:
            print('{:<1}*{:<1}={:<4}'.format(row,col,row*col),end=' ')
    print('')
print('='*80)
print('')


# 九九乘法表for_in 图形四
for a,row in enumerate(range(9,0,-1)):
    for b,col in enumerate(range(9,0,-1)):
        if a > b:
            print('{:<1}{:1}{:<1}{:1}{:<4}'.format(' ', ' ', ' ', ' ', ' '), end=' ')
        else:
            print('{:<1}*{:<1}={:<4}'.format(col, row, row * col), end=' ')
    print('')
print('='*80)


# 九九乘法表while 图形一
row = 1
col = 1
while row < 10:
    while 10 > col :
        print('{}*{}={:<4}'.format(col,row,row*col),end=' ')
        col = col+1
        if col > row:
            break
    print('')
    row = row+1
    col = 1
print('='*100)
print('')


# 九九乘法表for_in 图形二
row = 9
col = 1
while row > 0:
    while 10 > col :
        print('{}*{}={:<4}'.format(col,row,row*col),end=' ')
        col = col+1
        if col > row:
            break
    print('')
    row = row-1
    col = 1
print('='*100)
print('')

# 九九乘法表for_in 图形三
row = 1
col = 9
while row < 10:
    while col > 0:
        if col > row:
            print('{:<1}{:1}{:<1}{:1}{:<4}'.format(' ', ' ', ' ', ' ', ' '), end=' ')
        else:
            print('{:<1}*{:<1}={:<4}'.format(col, row, row * col), end=' ')
        col = col - 1
    print('')
    row = row+1
    col = 9
print('='*100)
print('')

# 九九乘法表for_in 图形四
row = 9
col = 9
while row > 0:
    while col > 0:
        if col > row:
            print('{:<1}{:1}{:<1}{:1}{:<4}'.format(' ', ' ', ' ', ' ', ' '), end=' ')
        else:
            print('{:<1}*{:<1}={:<4}'.format(col, row, row * col), end=' ')
        col = col - 1
    print('')
    row = row - 1
    col = 9
print('='*100)